import React, { Component } from 'react';
import { NavBar, List } from 'antd-mobile'
import "../../styles/My.scss"
// import * as service from "../../api/index"

class My extends Component {
    constructor(props) {
        super(props);
        this.state = {
            token: localStorage.getItem('token'),
            phone: localStorage.getItem('phone'),
            si: [
                { id: 0, ico: '📜', text: '全部订单' },
                { id: 1, ico: '💰', text: '待付款' },
                { id: 2, ico: '📦', text: '待收货' },
                { id: 3, ico: '👍', text: '待评价' },
            ]
        };
    }

    render() {
        return (

            <div className='my'>
                <div className="top">
                    <NavBar onBack={() => { this.props.history.go(-1) }} ><p>个人中心<span onClick={() => { this.props.history.push('/shezhi') }}>⚙</span></p> </NavBar>
                </div>
                <div className="touxiang">
                    <img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F284bee11-d32d-4560-97c2-f4a0bf1e0782%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1679144153&t=942ae8a276a7d4f00102b30fb2f25b95" alt="" />
                    {this.state.token ?
                        <span> {this.props.history.location.state} _ {this.state.phone}</span> :
                        <span onClick={() => { this.props.history.push('/login') }}>请点击登录</span>
                    }

                </div>
                <div className="si">
                    {
                        this.state.si.map((item) => {
                            return (
                                <div className="one" key={item.id} onClick={() => { this.props.history.push('/view_orders') }}>
                                    <span>{item.ico}</span>
                                    <p>{item.text}</p>
                                </div>
                            )
                        })
                    }
                </div>
                <div className="san">
                    <List>
                        <List.Item onClick={() => { this.props.history.push('/address') }}>
                            地址管理
                        </List.Item>
                        <List.Item onClick={() => { this.props.history.push('/shoucang') }}>
                            我的收藏夹
                        </List.Item>
                        <List.Item onClick={() => { this.props.history.push('/we')}}>
                            关于我们
                        </List.Item>
                    </List>

                </div>
                <div className="logo">
                    <img src="http://img.duoziwang.com/2018/13/03141728888120.jpg" alt="" />
                </div>
            </div>
        );
    }
}

export default My;